<template>
  <div>
    <div class="menu">
      <div class="icon" v-for="(item, index) in list" :key="index">
        <router-link :to="/category/+ item.id"
          ><b :style="{ backgroundColor: item.bg }">
            {{ item.category.substr(0, 1) }}
          </b></router-link
        >
        <p>{{ item.category }}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  computed: {
    list() {
      return this.$store.state.category;
    },
  },
  // created() {
  //   console.log(this.$store.state.category);

  // },
};
</script>

<style lang="scss" scoped>
.menu {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  .icon {
    width: 25%;
    text-align: center;
    margin: 8px 0;
    // padding-left: 12.5%;
    // box-sizing: border-box;
    b {
      display: inline-block;
      height: 60px;
      width: 60px;
      text-align: center;
      line-height: 60px;
      border-radius: 50%;
      font-size: 26px;
    }
  }
}
</style>